
//#if OPENGL
//#if MONOMAC
//using MonoMac.OpenGL;
//#elif WINDOWS || LINUX
//using OpenTK.Graphics.OpenGL;
//#elif GLES
//using OpenTK.Graphics.ES20;
//using BeginMode = OpenTK.Graphics.ES20.All;
//using EnableCap = OpenTK.Graphics.ES20.All;
//using TextureTarget = OpenTK.Graphics.ES20.All;
//using BufferTarget = OpenTK.Graphics.ES20.All;
//using BufferUsageHint = OpenTK.Graphics.ES20.All;
//using DrawElementsType = OpenTK.Graphics.ES20.All;
//using GetPName = OpenTK.Graphics.ES20.All;
//using FramebufferErrorCode = OpenTK.Graphics.ES20.All;
//using FramebufferTarget = OpenTK.Graphics.ES20.All;
//using FramebufferAttachment = OpenTK.Graphics.ES20.All;
//using RenderbufferTarget = OpenTK.Graphics.ES20.All;
//using RenderbufferStorage = OpenTK.Graphics.ES20.All;
//#endif
//#elif DIRECTX
//using SharpDX;
//using SharpDX.Direct3D;
//#if WINDOWS_PHONE
//using SharpDX.Direct3D11;
//using Windows.Foundation;
//using MonoGame.Framework.WindowsPhone;
//#elif WINDOWS_STOREAPP
//using Windows.UI.Xaml.Controls;
//using Windows.Graphics.Display;
//using Windows.UI.Core;
//using SharpDX.DXGI;
//#elif WINDOWS
//using SharpDX.DXGI;
//#endif
//#elif PSM
//using Sce.PlayStation.Core.Graphics;
//using PssVertexBuffer = Sce.PlayStation.Core.Graphics.VertexBuffer;
//#endif

#ifndef GraphicsDevice_h
#define GraphicsDevice_h

#include <Defines.h>
#include <CSharpPropertyMethods.h>

#include <System/Object.h>
#include <System/Nullable.h>
#include <System/IDisposable.h>
#include <System/Generic/EventHandler.h>

#include "States/BlendState.h"
#include "States/DepthStencilState.h"
#include "States/RasterizerState.h"
#include "../Rectangle.h"
#include "Viewport.h"
#include "Vertices/VertexBuffer.h"
#include "ResourceCreatedEventArgs.h"
#include "ResourceDestroyedEventArgs.h"
#include "presentationParameters.h"
#include "CubeMapFace.h"
#include "GraphicsProfile.h"
#include "DisplayMode.h"
#include "GraphicsDeviceStatus.h"
#include "Shader/Shader.h"
#include "Shader/ConstantBufferCollection.h"
#include "Vertices/PrimitiveType.h"
#include "ClearOptions.h"
#include "GraphicsAdapter.h"

//#include "Vertices/IndexBuffer.h"
#include "RenderTargetBinding.h"

namespace Riccsson
{
	namespace Xna
	{
		namespace Framework
		{
			
			// Forward declerations.
			class GraphicsDeviceManager;

			namespace Graphics
			{
				// Not implemented.
				class IndexBuffer;
				class RenderTarget2D;
				class RenderTargetCube;

				// Forward declerations.
				class TextureCollection;
				class SamplerStateCollection;

				class GraphicsDevice
					: Riccsson::System::Object
					, Riccsson::System::IDisposable
				{

					friend class GraphicsDeviceManager;

					public: static int DeviceScreenWidth;
					public: static int DeviceScreenHeight;

					public: Viewport _viewport; // Private...

					private: bool _isDisposed;

					private: GC_PTR<BlendState> _blendState;
					private: GC_PTR<DepthStencilState> _depthStencilState;
					private: GC_PTR<RasterizerState> _rasterizerState;

					private: bool _blendStateDirty;
					private: bool _depthStencilStateDirty;
					private: bool _rasterizerStateDirty;

					private: Rectangle _scissorRectangle;
					private: bool _scissorRectangleDirty;
  
					private: GC_PTR<VertexBuffer> _vertexBuffer;
					private: bool _vertexBufferDirty;

					private: GC_PTR<IndexBuffer> _indexBuffer;
					private: bool _indexBufferDirty;

					private: GC_PTR<Riccsson::System::Array<GC_PTR<RenderTargetBinding>>> _currentRenderTargetBindings;

					PROP3(GraphicsDevice, GC_PTR<DisplayMode>, displayMode);
					PROP3(GraphicsDevice, GraphicsDeviceStatus, graphicsDeviceStatus);
					PROP3(GraphicsDevice, Viewport, viewport);
					PROP3(GraphicsDevice, Rectangle, ScissorRectangle);
					PROP3(GraphicsDevice, GC_PTR<TextureCollection>, Textures);
					PROP3(GraphicsDevice, GC_PTR<SamplerStateCollection>, SamplerStates);
					PROP3(GraphicsDevice, GC_PTR<DepthStencilState>, depthStencilState);
					PROP3(GraphicsDevice, GC_PTR<BlendState>, blendState);
					PROP3(GraphicsDevice, GC_PTR<RasterizerState>, rasterizerState);
					PROP3(GraphicsDevice, bool, IsDisposed);
					PROP3(GraphicsDevice, bool, IsContentLost);
					PROP3(GraphicsDevice, bool, IsRenderTargetBound);
					
					COPY_CONSTRUCTOR(GraphicsDevice)
					{
						PROP3_INIT_COPY(GraphicsDevice, GC_PTR<DisplayMode>, displayMode);
						PROP3_INIT_COPY(GraphicsDevice, GraphicsDeviceStatus, graphicsDeviceStatus);
						PROP3_INIT_COPY(GraphicsDevice, Viewport, viewport);
						PROP3_INIT_COPY(GraphicsDevice, Rectangle, ScissorRectangle);
						PROP3_INIT_COPY(GraphicsDevice, GC_PTR<TextureCollection>, Textures);
						PROP3_INIT_COPY(GraphicsDevice, GC_PTR<SamplerStateCollection>, SamplerStates);
						PROP3_INIT_COPY(GraphicsDevice, GC_PTR<DepthStencilState>, depthStencilState);
						PROP3_INIT_COPY(GraphicsDevice, GC_PTR<BlendState>, blendState);
						PROP3_INIT_COPY(GraphicsDevice, GC_PTR<RasterizerState>, rasterizerState);
						PROP3_INIT_COPY(GraphicsDevice, bool, IsDisposed);
						PROP3_INIT_COPY(GraphicsDevice, bool, IsContentLost);
						PROP3_INIT_COPY(GraphicsDevice, bool, IsRenderTargetBound);
					}

					public: PROP3_GET(GC_PTR<TextureCollection>, Textures);
					private: PROP3_SET(GC_PTR<TextureCollection>, Textures);
					public: PROP3_GET(GC_PTR<SamplerStateCollection>, SamplerStates);
					private: PROP3_SET(GC_PTR<SamplerStateCollection>, SamplerStates);

					private: static /*readonly*/ Color DiscardColor;

					/// <summary>
					/// The active vertex shader.
					/// </summary>
					private: GC_PTR<Shader> _vertexShader;
					private: bool _vertexShaderDirty;

					/// <summary>
					/// The active pixel shader.
					/// </summary>
					private: GC_PTR<Shader> _pixelShader;
					private: bool _pixelShaderDirty;

			#if OPENGL
					static List<Action> disposeActions = new List<Action>();
					static object disposeActionsLock = new object();
			#endif

					private: readonly GC_PTR<ConstantBufferCollection> _vertexConstantBuffers;
					private: readonly GC_PTR<ConstantBufferCollection> _pixelConstantBuffers;

			#if DIRECTX
			
					// Core Direct3D Objects
					public: /*internal*/ SharpDX.Direct3D11.Device _d3dDevice;
					public: /*internal*/ SharpDX.Direct3D11.DeviceContext _d3dContext;
					protected: FeatureLevel _featureLevel;
					protected: SharpDX.Direct3D11.RenderTargetView _renderTargetView;
					protected: SharpDX.Direct3D11.DepthStencilView _depthStencilView;
			
			#if WINDOWS_STOREAPP
			
					// Declare Direct2D Objects
					protected: SharpDX.Direct2D1.Factory1 _d2dFactory;
					protected: SharpDX.Direct2D1.Device _d2dDevice;
					protected: SharpDX.Direct2D1.DeviceContext _d2dContext;
			
					// Declare DirectWrite & Windows Imaging Component Objects
					protected: SharpDX.DirectWrite.Factory _dwriteFactory;
					protected: SharpDX.WIC.ImagingFactory2 _wicFactory;
			
					// The swap chain resources.
					protected: SharpDX.Direct2D1.Bitmap1 _bitmapTarget;
					protected: SharpDX.DXGI.SwapChain1 _swapChain;
					protected: SwapChainBackgroundPanel _swapChainPanel;
			
					protected: float _dpi; 
			
			#elif !WINDOWS_PHONE
			
					protected: SwapChain _swapChain;
			
			#endif
			
					// The active render targets.
					protected: SharpDX.Direct3D11.RenderTargetView[] _currentRenderTargets = new SharpDX.Direct3D11.RenderTargetView[4];
			
					// The active depth view.
					protected: SharpDX.Direct3D11.DepthStencilView _currentDepthStencilView;
			
					private: readonly Dictionary<ulong, SharpDX.Direct3D11.InputLayout> _inputLayouts = new Dictionary<ulong, SharpDX.Direct3D11.InputLayout>();
			
					private: readonly Dictionary<int, DynamicVertexBuffer> _userVertexBuffers = new Dictionary<int, DynamicVertexBuffer>();
			
					private: readonly Dictionary<IndexElementSize, DynamicIndexBuffer> _userIndexBuffers = new Dictionary<IndexElementSize, DynamicIndexBuffer>();
			
			
			#endif // DIRECTX

			#if OPENGL

					private: readonly ShaderProgramCache _programCache = new ShaderProgramCache();

					private: int _shaderProgram = -1;

					static readonly Riccsson::System::Array<float> _posFixup = new float[4];

					public: /*internal*/ static readonly Riccsson::System::Collections::Generic::List<int> _enabledVertexAttributes = new List<int>();

			#elif PSM
			
					public: /*internal*/ GraphicsContext _graphics;
					public: /*internal*/ List<PssVertexBuffer> _availableVertexBuffers = new List<PssVertexBuffer>();
					public: /*internal*/ List<PssVertexBuffer> _usedVertexBuffers = new List<PssVertexBuffer>();
			#endif

			#if GLES
					const FramebufferTarget GLFramebuffer = FramebufferTarget.Framebuffer;
					const RenderbufferTarget GLRenderbuffer = RenderbufferTarget.Renderbuffer;
					const FramebufferAttachment GLDepthAttachment = FramebufferAttachment.DepthAttachment;
					const FramebufferAttachment GLStencilAttachment = FramebufferAttachment.StencilAttachment;
					const FramebufferAttachment GLColorAttachment0 = FramebufferAttachment.ColorAttachment0;
					const GetPName GLFramebufferBinding = GetPName.FramebufferBinding;
					const RenderbufferStorage GLDepthComponent16 = RenderbufferStorage.DepthComponent16;
					const RenderbufferStorage GLDepthComponent24 = RenderbufferStorage.DepthComponent24Oes;
					const RenderbufferStorage GLDepth24Stencil8 = RenderbufferStorage.Depth24Stencil8Oes;
					const FramebufferErrorCode GLFramebufferComplete = FramebufferErrorCode.FramebufferComplete;
			#elif OPENGL
					const FramebufferTarget GLFramebuffer = FramebufferTarget.FramebufferExt;
					const RenderbufferTarget GLRenderbuffer = RenderbufferTarget.RenderbufferExt;
					const FramebufferAttachment GLDepthAttachment = FramebufferAttachment.DepthAttachmentExt;
					const FramebufferAttachment GLStencilAttachment = FramebufferAttachment.StencilAttachment;
					const FramebufferAttachment GLColorAttachment0 = FramebufferAttachment.ColorAttachment0;
					const GetPName GLFramebufferBinding = GetPName.FramebufferBinding;
					const RenderbufferStorage GLDepthComponent16 = RenderbufferStorage.DepthComponent16;
					const RenderbufferStorage GLDepthComponent24 = RenderbufferStorage.DepthComponent24;
					const RenderbufferStorage GLDepth24Stencil8 = RenderbufferStorage.Depth24Stencil8;
					const FramebufferErrorCode GLFramebufferComplete = FramebufferErrorCode.FramebufferComplete;
			#endif

					// TODO Graphics Device events need implementing
					public: event<Void, Riccsson::System::Generic::EventHandler<Riccsson::System::EventArgs>> DeviceLost;
					public: event<Void, Riccsson::System::Generic::EventHandler<Riccsson::System::EventArgs>> DeviceReset;
					public: event<Void, Riccsson::System::Generic::EventHandler<Riccsson::System::EventArgs>> DeviceResetting;
					public: event<Void, Riccsson::System::Generic::EventHandler<ResourceCreatedEventArgs>> ResourceCreated;
					public: event<Void, Riccsson::System::Generic::EventHandler<ResourceDestroyedEventArgs>> ResourceDestroyed;
					public: event<Void, Riccsson::System::Generic::EventHandler<Riccsson::System::EventArgs>> Disposing;


			#if OPENGL
					public: /*internal*/ int glFramebuffer;
					public: /*internal*/ int glRenderTargetFrameBuffer;
					public: /*internal*/ int MaxVertexAttributes;        
					public: /*internal*/ readonly List<string> _extensions = new List<string>();
					public: /*internal*/ int _maxTextureSize = 0;
			#endif
        
					public: /*internal*/ int MaxTextureSlots;

			//#if WINDOWS_STOREAPP
			//
			//		public: /*internal*/ float Dpi
			//		{
			//			get { return _dpi; }
			//			set
			//			{
			//				if (_dpi == value)
			//					return;
			//
			//				_dpi = value;
			//				_d2dContext.DotsPerInch = new DrawingSizeF(_dpi, _dpi);
			//
			//				//if (OnDpiChanged != null)
			//					//OnDpiChanged(this);
			//			}
			//		}
			//
			//#endif


			#if OPENGL

					public: /*internal*/ void SetVertexAttributeArray(Riccsson::System::Array<bool>* attrs);

			#endif
							

					public: PROP3_GET(bool, IsDisposed);
					private: PROP3_SET(bool, IsDisposed){throw;}
					public: PROP3_GET(bool, IsContentLost);
					private: PROP3_SET(bool, IsContentLost){throw;}
					public: /*internal*/ PROP3_GET(bool, IsRenderTargetBound);
					private: /*internal*/PROP3_SET(bool, IsRenderTargetBound){throw;}
					public: GraphicsDevice ();
					~GraphicsDevice();
			#if OPENGL
					List<string> GetGLExtensions();
			#endif // OPENGL

					public: /*internal*/ void Initialize();

			#if DIRECTX 

			#if WINDOWS_PHONE

					public: /*internal*/ void UpdateDevice(Device device, DeviceContext context);
					public: /*internal*/ void UpdateTarget(RenderTargetView renderTargetView);

			#elif WINDOWS_STOREAPP

					/// <summary>
					/// Creates resources not tied the active graphics device.
					/// </summary>
					protected: void CreateDeviceIndependentResources();

					/// <summary>
					/// Create graphics device specific resources.
					/// </summary>
					protected: virtual void CreateDeviceResources();

					public: /*internal*/ void CreateSizeDependentResources();

			#elif WINDOWS

					/// <summary>
					/// Create graphics device specific resources.
					/// </summary>
					protected: virtual void CreateDeviceResources();

					public: /*internal*/ void CreateSizeDependentResources();
		
			#endif // WINDOWS

			#endif // DIRECTX
					
					public: PROP3_GET(GC_PTR<RasterizerState>, rasterizerState);
					public: PROP3_SET(GC_PTR<RasterizerState>, rasterizerState);
					public: PROP3_GET(GC_PTR<BlendState>, blendState);
					public: PROP3_SET(GC_PTR<BlendState>, blendState);
					public: PROP3_GET(GC_PTR<DepthStencilState>, depthStencilState);
					public: PROP3_SET(GC_PTR<DepthStencilState>, depthStencilState);
					public: void Clear(Color color);
					public: void Clear(ClearOptions options, Color color, float depth, int stencil);
					public: void Clear(ClearOptions options, Vector4 color, float depth, int stencil);
					public: void Dispose();
					protected: virtual void Dispose(bool disposing);

			#if OPENGL
					/// <summary>
					/// Adds a dispose action to the list of pending dispose actions. These are executed at the end of each call to Present().
					/// This allows GL resources to be disposed from other threads, such as the finalizer.
					/// </summary>
					/// <param name="disposeAction">The action to execute for the dispose.</param>
					static public: /*internal*/ void AddDisposeAction(Action disposeAction);
			#endif

					public: void Present();

					public: void Present(Riccsson::System::Nullable<Rectangle> sourceRectangle, Riccsson::System::Nullable<Rectangle> destinationRectangle, Riccsson::System::IntPtr overrideWindowHandle);
					public: void Reset();
					public: void Reset(GC_PTR<PresentationParameters> presentationParameters);
					public: void Reset(GC_PTR<PresentationParameters> presentationParameters, GC_PTR<GraphicsAdapter> graphicsAdapter);

					/// <summary>
					/// Trigger the DeviceResetting event
					/// Currently public: /*internal*/ to allow the various platforms to send the event at the appropriate time.
					/// </summary>
					public: /*internal*/ void OnDeviceResetting();

					/// <summary>
					/// Trigger the DeviceReset event to allow games to be notified of a device reset.
					/// Currently public: /*internal*/ to allow the various platforms to send the event at the appropriate time.
					/// </summary>
					public: /*internal*/ void OnDeviceReset();
					public: PROP3_GET(GC_PTR<DisplayMode>, displayMode);
					private: PROP3_SET(GC_PTR<DisplayMode>, displayMode);

					public: PROP3_GET(GraphicsDeviceStatus, graphicsDeviceStatus);
					private: PROP3_SET(GraphicsDeviceStatus, graphicsDeviceStatus);

					public: GC_PTR<PresentationParameters> presentationParameters;//{get; private: set;}

					public: PROP3_GET(Viewport, viewport);
					public: PROP3_SET(Viewport, viewport);

					public: GraphicsProfile graphicsProfile; // { get; set; }

					public: PROP3_GET(Rectangle, ScissorRectangle);
					public: PROP3_SET(Rectangle, ScissorRectangle);
					public: void SetRenderTarget(GC_PTR<RenderTarget2D> renderTarget);
					public: void SetRenderTarget(GC_PTR<RenderTargetCube> renderTarget, CubeMapFace cubeMapFace);
					public: void SetRenderTargets(Riccsson::System::Array<GC_PTR<RenderTargetBinding>>* renderTargets);
					public: /*internal*/ void ApplyRenderTargets(Riccsson::System::Array<GC_PTR<RenderTargetBinding>>* renderTargets);

			#if WINRT
					public: /*internal*/ void ResetRenderTargets();
			#endif

					public: GC_PTR<Riccsson::System::Array<GC_PTR<RenderTargetBinding>>> GetRenderTargets();

			#if OPENGL

					private: static BeginMode PrimitiveTypeGL(PrimitiveType primitiveType);
		
			#elif DIRECTX

					private: static PrimitiveTopology ToPrimitiveTopology(PrimitiveType primitiveType);
		
			#endif


					public: void SetVertexBuffer(GC_PTR<VertexBuffer> vertexBuffer);

					private: void SetIndexBuffer(GC_PTR<IndexBuffer> indexBuffer);
					public: PROP3_GET(GC_PTR<IndexBuffer>, Indices);
					public: PROP3_SET(GC_PTR<IndexBuffer>, Indices);
					public: /*internal*/ PROP3_GET(Shader, VertexShader);
					public: /*internal*/ PROP3_SET(Shader, VertexShader);
					public: /*internal*/ PROP3_GET(Shader, PixelShader);
					public: /*internal*/ PROP3_SET(Shader, PixelShader);

					public: /*internal*/ void SetConstantBuffer(ShaderStage* stage, int slot, GC_PTR<ConstantBuffer> buffer);

			#if OPENGL

					/// <summary>
					/// Activates the Current Vertex/Pixel shader pair into a program.         
					/// </summary>
					private: void ActivateShaderProgram();
			#endif

					public: bool ResourcesLost;// { get; set; }

					public: /*internal*/ void ApplyState(bool applyShaders);

			#if DIRECTX

					private: SharpDX.Direct3D11.InputLayout GetInputLayout(Shader shader, VertexDeclaration decl)
					{
						SharpDX.Direct3D11.InputLayout layout;

						// Lookup the layout using the shader and declaration as the key.
						var key = (ulong)decl.HashKey << 32 | (uint)shader.HashKey;           
						if (!_inputLayouts.TryGetValue(key, out layout))
						{
							layout = new SharpDX.Direct3D11.InputLayout(_d3dDevice, shader.Bytecode, decl.GetInputLayout());
							_inputLayouts.Add(key, layout);
						}

						return layout;
					}

					private: int SetUserVertexBuffer<T>(T[] vertexData, int vertexOffset, int vertexCount, VertexDeclaration vertexDecl) 
						where T : struct, IVertexType
					{
						DynamicVertexBuffer buffer;

						if (!_userVertexBuffers.TryGetValue(vertexDecl.HashKey, out buffer) || buffer.VertexCount < vertexCount)
						{
							// Dispose the previous buffer if we have one.
							if (buffer != null)
								buffer.Dispose();

							buffer = new DynamicVertexBuffer(this, vertexDecl, Math.Max(vertexCount, 2000), BufferUsage.WriteOnly);
							_userVertexBuffers[vertexDecl.HashKey] = buffer;
						}

						var startVertex = buffer.UserOffset;


						if ((vertexCount + buffer.UserOffset) < buffer.VertexCount)
						{
							buffer.UserOffset += vertexCount;
							buffer.SetData(startVertex * vertexDecl.VertexStride, vertexData, vertexOffset, vertexCount, vertexDecl.VertexStride, SetDataOptions.NoOverwrite);
						}
						else
						{
							buffer.UserOffset = vertexCount;
							buffer.SetData(vertexData, vertexOffset, vertexCount, SetDataOptions.Discard);
							startVertex = 0;
						}

						SetVertexBuffer(buffer);

						return startVertex;
					}

					private: int SetUserIndexBuffer<T>(T[] indexData, int indexOffset, int indexCount)
						where T : struct
					{
						DynamicIndexBuffer buffer;

						var indexType = typeof(T);
						var indexSize = Marshal.SizeOf(indexType);
						var indexElementSize = indexSize == 2 ? IndexElementSize.SixteenBits : IndexElementSize.ThirtyTwoBits;

						if (!_userIndexBuffers.TryGetValue(indexElementSize, out buffer) || buffer.IndexCount < indexCount)
						{
							if (buffer != null)
								buffer.Dispose();

							buffer = new DynamicIndexBuffer(this, indexElementSize, Math.Max(indexCount, 6000), BufferUsage.WriteOnly);
							_userIndexBuffers[indexElementSize] = buffer;
						}

						var startIndex = buffer.UserOffset;

						if ((indexCount + buffer.UserOffset) < buffer.IndexCount)
						{
							buffer.UserOffset += indexCount;
							buffer.SetData(startIndex * indexSize, indexData, indexOffset, indexCount, SetDataOptions.NoOverwrite);
						}
						else
						{
							startIndex = 0;
							buffer.UserOffset = indexCount;
							buffer.SetData(indexData, indexOffset, indexCount, SetDataOptions.Discard);
						}

						Indices = buffer;

						return startIndex;
					}
			#endif

					/// <summary>
					/// Draw geometry by indexing into the vertex buffer.
					/// </summary>
					/// <param name="primitiveType">The type of primitives in the index buffer.</param>
					/// <param name="baseVertex">Used to offset the vertex range indexed from the vertex buffer.</param>
					/// <param name="minVertexIndex">A hint of the lowest vertex indexed relative to baseVertex.</param>
					/// <param name="numVertices">An hint of the maximum vertex indexed.</param>
					/// <param name="startIndex">The index within the index buffer to start drawing from.</param>
					/// <param name="primitiveCount">The number of primitives to render from the index buffer.</param>
					/// <remarks>Note that minVertexIndex and numVertices are unused in MonoGame and will be ignored.</remarks>
					public: void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount);

					public: template<typename T> void DrawUserPrimitives(PrimitiveType primitiveType, Riccsson::System::Array<T>* vertexData, int vertexOffset, int primitiveCount)// where T : struct, IVertexType
					{
						throw;
					}

					public: template<typename T> void DrawUserPrimitives(PrimitiveType primitiveType, Riccsson::System::Array<T>* vertexData, int vertexOffset, int primitiveCount, VertexDeclaration vertexDeclaration)// where T : struct, IVertexType
					{
						throw;
					}

					public: void DrawPrimitives(PrimitiveType primitiveType, int vertexStart, int primitiveCount);

					public: template<typename T> void DrawUserIndexedPrimitives(PrimitiveType primitiveType, Riccsson::System::Array<T>* vertexData, int vertexOffset, int numVertices, Riccsson::System::Array<short>* indexData, int indexOffset, int primitiveCount)// where T : struct, IVertexType
					{
						throw;
					}

					public: template<typename T> void DrawUserIndexedPrimitives(PrimitiveType primitiveType, Riccsson::System::Array<T>* vertexData, int vertexOffset, int numVertices, Riccsson::System::Array<short>* indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration)// where T : struct, IVertexType
					{
						throw;
					}

					public: template<typename T> void DrawUserIndexedPrimitives(PrimitiveType primitiveType, Riccsson::System::Array<T>* vertexData, int vertexOffset, int numVertices, Riccsson::System::Array<int>* indexData, int indexOffset, int primitiveCount)// where T : struct, IVertexType
					{
						throw;
					}

					public: template<typename T> void DrawUserIndexedPrimitives(PrimitiveType primitiveType, Riccsson::System::Array<T>* vertexData, int vertexOffset, int numVertices, Riccsson::System::Array<int>* indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration)// where T : struct, IVertexType
					{
						throw;
					}

			#if PSM
					public: /*internal*/ PssVertexBuffer GetVertexBuffer(VertexFormat[] vertexFormat, int requiredVertexLength, int requiredIndexLength)
					{
						throw;
					}
        
					/// <summary>
					/// Set the current _graphics VertexBuffer based on _vertexBuffer and _indexBuffer, reusing an existing VertexBuffer if possible
					/// </summary>
					private: void BindVertexBuffer(bool bindIndexBuffer)
					{
						throw;
					}
			#endif

					private: static int GetElementCountArray(PrimitiveType primitiveType, int primitiveCount);
		
				};
			}
		}
	}
}

#endif